import java.util.Timer;
import java.util.TimerTask;

//计时器
public class ThreadDemo25 {
    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello timer");
                timer.cancel();//该进程不会主动结束，必须使用cancel
            }
        },3000);
        System.out.println("hello no wait timer");
    }
}
